/*
 *  Copyright (C) 2025 ameise <ameise.wang@gmail.com> - All Rights Reserved
 *
 *  This file is part of e3utils.
 *
 *  e3utils is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  e3utils is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with e3utils. If not, see <https://www.gnu.org/licenses/>.
 */

package errors

import (
	"errors"
	"fmt"
)

func NewOrWrap(err error, msg string) error {
	return NewOrWrapNoStack(err, msg)
}

func NewOrWrapPrintf(err error, format string, a ...any) error {
	return NewOrWrapNoStack(err, fmt.Sprintf(format, a...))
}

func New(msg string) error {
	return NewNoStack(msg)
}

func NewPrintf(format string, a ...any) error {
	return NewNoStack(fmt.Sprintf(format, a...))
}

func Wrap(err error, msg string) error {
	return WrapNoStack(err, msg)
}

func WrapPrintf(err error, format string, a ...any) error {
	return WrapNoStack(err, fmt.Sprintf(format, a...))
}

var As = errors.As
var Is = errors.Is
